package com.wish.g01.common.log.service;

import com.wish.g01.system.api.RemoteLogService;
import com.wish.g01.system.api.domain.SysOperLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * 异步调用日志服务
 * 
 * @author wish-g01
 */
@Service
public class AsyncLogService
{
    @Autowired
    private RemoteLogService remoteLogService;

    /**
     * 异步 保存系统日志记录
     */

//    @Async
//    public void saveSysLog(SysOperLog sysOperLog)
//    {
//        // kafka 异步保存 日志数据库
//        remoteLogService.saveLog(sysOperLog);
//    }

    @Async
    public void saveSysLog(SysOperLog sysOperLog)
    {
        // 远程调用日志服务 通过kafka 异步保存 日志数据库
        remoteLogService.saveLog(sysOperLog);
    }


//    public void kafkaSaveSysLog(SysOperLog sysOperLog){
//        String key = UUID.randomUUID().toString();
//        kafkaTemplate.send("log",key, JSON.toJSONString(sysOperLog));
//    }


}
